﻿using System;
using System.Collections.Generic;
using System.Text;
using PipeTest.Game;

namespace PipeTest.Script
{
   public  class ScriptContext
    {
       private GameVistor gameVistor;
       private int currentActionIndex;
       private List<ScriptAction> actionsToexecute;

       public GameVistor GameVistor
       {
           get { return gameVistor; }
           set { gameVistor = value; }
       }

       public int CurrentActionIndex
       {
           get { return currentActionIndex; }
           set { currentActionIndex = value; }
       }

       public List<ScriptAction> ActionsToexecute
       {
           get { return actionsToexecute; }
           set { actionsToexecute = value; }
       }

       public ScriptAction CurrentAction
       {
           get { return actionsToexecute[currentActionIndex]; }
       }

       public int FindScriptActionByName(string name)
       {
           return actionsToexecute.FindIndex(
               current => name.Equals(current.Name, StringComparison.CurrentCultureIgnoreCase));
       }

       public bool IsEnd()
       {
           return currentActionIndex == actionsToexecute.Count;
       }
    }
}
